﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Security.Principal;

namespace SuzhouBus
{
    public partial class FormProxy : Form
    {
        public NetworkCredential Credential { get; set; }

        public FormProxy()
        {
            InitializeComponent();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.Credential = new NetworkCredential(this.textBoxUserName.Text.Trim(), this.textBoxPassword.Text.Trim(), this.textBoxDomain.Text.Trim());
        }

        private void FormProxy_Load(object sender, EventArgs e)
        {
            //WindowsIdentity currentUser = WindowsIdentity.GetCurrent();
            //if (currentUser != null)
            //{
            //    this.textBoxDomain.Text = currentUser.User.AccountDomainSid.
            //    this.textBoxUserName.Text = currentUser.Name;
            //}
            this.textBoxDomain.Text = Environment.UserDomainName;
            this.textBoxUserName.Text = Environment.UserName;
        }
    }
}
